Skip to content

Conversation

@robertobermejo
Copy link

As you can see in the Brew.sh documentation, there are different paths depending on the Mac's processor.

This script installs Homebrew to its preferred prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon and /home/linuxbrew/.linuxbrew for Linux) so that you don’t need sudo when you brew install. It is a careful script; it can be run even if you have stuff installed in the preferred prefix already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.

@gtrabanco
Copy link
Contributor

gtrabanco commented Apr 18, 2022

The best approach is to use HOBREW_PREFIX env or get the brew prefix by executing brew --prefix. You can see an example in this url where I have it fixed:

Comment on lines +25 to +29
if [[ $(uname -m) == 'arm64' ]]; then
ZSH_BIN_PATH='/opt/homebrew/bin/zsh'
else
ZSH_BIN_PATH='/usr/local/bin/zsh'
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZSH_BIN_PATH="$(brew --prefix zsh)"

You can get the prefix of installed packages with brew with brew --prefix <package>

But could happen that the command is being executed in a system without brew or installed in other way or with brew prefix not added but installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants